ButtonGroup

Kind of class:class
Inherits from:EventDispatcher
Classpath:gfx.controls.ButtonGroup
File last modified:Tuesday, 29 June 2010, 09:03:27
The CLIK ButtonGroup component is used to manage sets of buttons. It allows one button in the set to be selected, and ensures that the rest are unselected. If the user selects another button in the set, then the currently selected button will be unselected. Any component that derives from the CLIK Button component (such as CheckBox and RadioButton) can be assigned a ButtonGroup instance.

Inspectable Properties
The ButtonGroup does not have a visual representation on the Stage. Therefore no inspectable properties are available.

States
The ButtonGroup does not have a visual representation on the Stage. Therefore no states are associated with it.

Events
All event callbacks receive a single Object parameter that contains relevant information about the event. The following properties are common to all events.
  • type: The event type.
  • target: The target that generated the event.
The events generated by the ButtonBar component are listed below. The properties listed next to the event are provided in addition to the common properties.
  • change: A new button from the group has been selected.
    • item: The selected Button. CLIK Button type.
    • data: The data value of the selected Button. AS2 Object type.
  • itemClick: A button in the group has been clicked.
    • item: The Button that was clicked. CLIK Button type.

Summary


Constructor
Instance properties
  • name
    • The name of the ButtonGroup, specified by the groupName property on the subscribing Buttons.
  • selectedButton
    • The current Button that is selected.
  • scope
    • The MovieClip container in which this ButtonGroup belongs.
  • length
    • The number of buttons in the group.
  • data
    • The data property of the currently selected button.
Class methods
Instance methods

Constructor

ButtonGroup

function ButtonGroup (
name:String, scope:MovieClip)

Create a new ButtonGroup. This class is usually instantiated by the first subscribing button, and stored in its parent MovieClip so that other buttons in the same movieClip, with the same groupName will all behave as a group.
Parameters:
name :
The name of the ButtonGroup, specified by the groupName property of the subscribing buttons.
scope:
The MovieClip scope that the ButtonGroup resides.
See also:

Instance properties

data

data:Object
(read)

The data property of the currently selected button.

length

length:Number
(read)

The number of buttons in the group.

name

name:String = "buttonGroup"
(read,write)

The name of the ButtonGroup, specified by the groupName property on the subscribing Buttons.
See also:

scope

scope:MovieClip
(read,write)

The MovieClip container in which this ButtonGroup belongs.

selectedButton

selectedButton:Button
(read,write)

The current Button that is selected. Only a single Button can be selected at one time.

Instance methods

addButton

function addButton (
button:Button) : Void

Add a Button to group. A Button can only be added once to a ButtonGroup, and can only exist in a single group at a time. Buttons will change the selection of a ButtonGroup by dispatching "select" and "click" events.
Parameters:
button:
The Button instance to add to this group

getButtonAt

function getButtonAt (
index:Number) : Button

Find a button at a specified index in the ButtonGroup. Buttons are indexed in the order that they are added.
Parameters:
index:
Index in the ButtonGroup of the Button.
Returns:
  • The button at the specified index. null if there is no button at that index.

indexOf

function indexOf (
button:Button) : Number

Find the index of a button in the ButtonGroup. Buttons are indexed in the order that they are added.
Parameters:
button:
The button to find in the ButtonGroup
Returns:
  • The index of the specified Button. -1 if it is not found.

removeButton

function removeButton (
button:Button) : Void

Remove a button from the group. If it the last button in the group, the button should clean up and destroy the ButtonGroup.
Parameters:
button:
The Button instance to be removed from group.

setSelectedButton

function setSelectedButton (
button:Button) : Void

Sets the specified button to the selectedButton. The selected property of the previous selected Button will be set to false. If null is passed to this method, the current selected Button will be deselected, and the selectedButton property set to null.
Parameters:
button:
The button instance to select.
See also: